<?php

class SysMenuModel extends CommonModel {

    public function getList() {
        $res = $this->where('pid=0')->order('sort_order')->select();
        $returns = array();
        foreach ($res as $row) {
            $count = $this->where('pid=' . $row['id'])->count();
            if ($count > 0) {
                $rows = $this->where('pid=' . $row['id'])->order('sort_order')->select();
                $row['menus'] = $rows;
            }
            $returns[$row['id']] = $row;
        }
        return $returns;
    }

}

?>
